package model.beans;

import java.io.Serializable;
import java.sql.SQLException;

public class CategoryBean implements Serializable{
	
	private static final long serialVersionUID = 893137778379255871L;
	private int id;
	private String name;
	private String description;
	private byte[] picture;
	
	/**
	 * @return the id
	 */
	
	public int getId() {
		return id;
	}
	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}
	/**
	 * @return the description
	 */
	public String getDescription() {
		return description;
	}

	public String getPicture() {
    	byte[] bufPic = new byte[picture.length];
    	System.arraycopy(picture, 0, bufPic, 0, picture.length);
    	String base64Image = new sun.misc.BASE64Encoder().encode(bufPic);
    	String cleanedImage = base64Image.replace("\\s", "");
    	
		return cleanedImage;

	}
	/**
	 * @param id the id to set
	 */
	public void setId(int id)
	{
		this.id = id;
	}
	/**
	 * @param name the name to set
	 */
	public void setName(String name)
	{
		this.name = name;
	}
	/**
	 * @param description the description to set
	 */
	public void setDescription(String description)
	{
		this.description = description;
	}
	/**
	 * @param imgFilename the imgFilename to set
	 * @throws SQLException 
	 */

	public void setPicture(byte[] picture) throws SQLException
	{		
		this.picture = picture;		
	}	
}
